﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Log.Object;
using Newtonsoft.Json;

namespace Log.Controller
{
    public static class ConvertLog
    {
        public static List<LogCode> GetLogListFromText(string _text)
        {
            List<LogCode> lcList = null;
            try
            {
                lcList = JsonConvert.DeserializeObject<List<LogCode>>(_text);
            }
            catch
            {
            }

            if (lcList == null)
                lcList = new List<LogCode>();
            return lcList;
        }

        public static string GetTextFromLogList(List<LogCode> _lcList)
        {
            string strText = "[]";
            try
            {
                strText = JsonConvert.SerializeObject(_lcList);
            }
            catch
            {
            }
            return strText;
        }
    }
}
